//
//  DeviceDiskSpaceManager.m
//  MobileVLCKitDemo
//
//  Created by 金色榜样研发组 on 2019/5/29.
//  Copyright © 2019 Golden Bangyang (beijing) Cul Ture Media Investment Co. All rights reserved.
//

#import "DeviceDiskSpaceManager.h"

#include <sys/param.h>
#include <sys/mount.h>


@implementation DeviceDiskSpaceManager
#pragma mark - 获取设备的剩余存储空间
+ (FileSizeModel *)getFreeDiskSpace
{
    struct statfs buf;
    unsigned long long freeSpace = -1;
    if (statfs("/var", &buf) >= 0) {
        freeSpace = (unsigned long long)(buf.f_bsize * buf.f_bavail);
    }
    FileSizeModel *model = [SizeManager convertWithSize:(freeSpace * 1.0)];
    return model;
}

@end
